#include<iostream>
#include<string.h>
using namespace std;
class Date
{
    private:
    	int year,month,day;
	public:
	    Date(int y,int m,int d);
    	void PrintDate(); 
};
Date::Date(int y,int m,int d)
{
	year=y;
	month=m;
	day=d;
}
void Date::PrintDate()
{
	cout<<year<<"-"<<month<<"-"<<day<<endl;
}
class Product
{
	private:
	char *name;
	double price;
	Date pr_date;
	Date ex_date;
	char *factory;
	bool breakable;
	double length;
	double speed;
	double displacement;
	public:
	Product(char *n);
	Product(char *n,double p);
	Product(char *n,double p,Date &pr);
	void printinfo();
	void editproduct(char *n,double p,Date &pr,char *m,bool i,Date &ex,double l,double s,double d);
 } ;
Product::Product(char *n)
 {
 	name=new char[strlen(n)+1];
 	strcpy(name,n);
 }
  Product::Product(char *n,double p)
 {
 	name=new char[strlen(n)+1];
 	strcpy(name,n);
 	price=p;
 }
   Product::Product(char *n,double p,Date &pr)
 {
 	name=new char[strlen(n)+1];
 	strcpy(name,n);
 	price=p;
 	pr_date=pr;
 }
 void Product::printinfo()
 {
 	cout<<"产品名称："<<name<<endl;
 	cout<<"产品价格："<<price<<"亿美元"<<endl;
 	cout<<"生产日期：";
 	pr_date.PrintDate();
 	cout<<"生产厂商："<<factory<<endl;
 	cout<<"是否易碎："<<breakable<<endl;
 	cout<<"有效日期：";
 	ex_date.PrintDate();
 	cout<<"长度："<<length<<"米"<<endl;
 	cout<<"最高速度："<<speed<<"节"<<endl;
 	cout<<"排水量："<<displacement<<"吨"<<endl;
 }
void Product::editproduct(char *n,double p,Date &pr,char *m,bool i,Date &ex,double l,double s,double d)
 {
	name=new char[strlen(n)+1];
 	strcpy(name,n);
 	price=p;
 	pr_date=pr;
	factory=new char[strlen(m)+1];
 	strcpy(factory,m);
 	breakable=i;
 	ex_date=ex;
 	length=l;
 	speed=s;
 	displacement=d;
 }
 int main()
 {
 	Date date1(1961,11,25),date2(2012,12,1);
 	Product pen("企业号航母");
 	pen.editproduct("企业号航母",4.5,date1,"纽波特纽斯船厂",false,date2,342,33,85600);
 	pen.printinfo();
 	return 0;	
 }
 